package com.xhkj.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xhkj.mapper.my.GaoDeMapper;
import com.xhkj.model.GaodeLocation;
import com.xhkj.util.GaoDeUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(tags = { "05.高德数据获取" })
@RestController
@RequestMapping("gaode")
public class GaoDeController {

	@Autowired
	private GaoDeMapper mapper;

	@ApiOperation(value = "获取数据")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "req", value = "获取数据", required = true, paramType = "body"),
	})
	@PostMapping("getData")
	public Object getData(@RequestParam String keyWord, @RequestParam String city) {
		String url = "https://restapi.amap.com/v3/place/text?keywords="+keyWord+"&city="+city+"&output=JSON&offset=2000&page=0&key=5aeb0c87687eff78f5dd75af2f90c929&citylimit=true&extensions=all";
	    GaodeLocation result = GaoDeUtil.getLocatoin(url);
		return result;
	}

}
